<template>
    <div>
        <input type="button" value="录入房号" @click="add">
        <table class="table">
            <thead class="table">
                <tr>
                    <td>房号</td>
                    <td>地址</td>
                    <td>类型</td>
                    <td>照片</td>
                    <td>状态</td>
                    <td></td>
                </tr>
            </thead>
            <tbody class="table-primary">
                <tr v-for="a in data">
                    <td>{{a.hname}}</td>
                    <td>{{ a.address }}</td>
                    <td>{{a.tname}}</td>
                    <td>
                        <img :src="'https://localhost:7279'+a.himg" style="width: 80px;height: 80px;">
                    </td>
                    <td>{{a.isStatus?"可预订":"已入住"}}</td>
                    <td></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';

onMounted(()=>{
    show();
})

const can=ref({
    pageindex:1,
    pagesize:20
})
const data=ref([{
    "hmid": 1,
      "hname": "string",
      "address": "string",
      "tid": 2,
      "himg": "string",
      "isStatus": true,
      "tname": "兰"
}])

const show=()=>{
    axios.get("https://localhost:7279/api/Hotel/GetHotelList",{params:can.value}).then(res=>{
        data.value=res.data.row;
    })
}
const router=useRouter();
const add=()=>{
    router.push({path:'/AddView'});
}


</script>

<style scoped>

</style>